<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link href="../resources/css/jquery-ui-themes.css" type="text/css"
	rel="stylesheet" />
<link href="../resources/css/axure_rp_page.css" type="text/css"
	rel="stylesheet" />
<link href="../data/styles.css" type="text/css" rel="stylesheet" />
<link href="../files/index/styles.css" type="text/css" rel="stylesheet" />
<script src="../resources/scripts/jquery-1.7.1.min.js"></script>
<script src="../resources/scripts/jquery-ui-1.8.10.custom.min.js"></script>
<script src="../resources/scripts/prototypePre.js"></script>
<script src="../data/document.js"></script>
<script src="../resources/scripts/prototypePost.js"></script>
<script type="text/javascript" src="../resources/scripts/echarts.js" ></script>
<script src="../files/index/data.js"></script>



<style type="text/css">
#login {
	width: 380px;
	height: 580px;
	text-align: center;
	margin: 0 auto;
	border: 1px solid #ddd;
	display: none;
	z-index: 1000;
	position: relative;
	top:-100%;
	background: #fff;
}
li{
				font-family:"微软雅黑";
				color: darkgray;
				text-align: left;
			
				
			}
			ul{
				z-index: 2;
				position: relative;
				left: -10px;
			}
li:link{
text-decoration: none;
background-color:none;
color: black;
font-family: "黑体"
}
li:hover{
			text-decoration: underline;
			color: black;
			
}
li:active{
			text-decoration: underline;
			text-underline-color: cornflowerblue;
			color:white;
}
#login .close {
	width: 15px;
	height: px;
	margin: 5px 2px 0px 332px
}
a{text-decoration:none}
#login h3 {
	color: #666;
	font-size: 25px;
	font-family: "微软雅黑";
	text-align: center;
}

#login .con {
	width: 293px;
	height: 300px;
	margin: 2px auto
}

#login .con p {
	color: #666;
	font-size: 20px;
	font-family: "微软雅黑";
	height: 40px;
	line-height: 40px
}

#login .con p input {
	height: 35px;
	width: 300px
}

#login .con p input.but {
	margin: 80px auto;
	color: #fff;
	font-size: 20px;
	font-family: "微软雅黑";
	background: black;
	border: none
}

#login .wjmm p {
	font-size: 15px;;
	float: right;
	margin: 20px 0px 0px 0px
}

#registered {
	width: 380px;
	height: 580px;
	text-align: center;
	margin: 0 auto;
	border: 1px solid #ddd; z-index;
	position: relative;
		top:-100%;
	background: #fff;
	display: none;
}

#registered .close {
	width: 15px;
	height: px;
	margin: 1px 2px 0px 332px
}

#registered h3 {
	color: #666;
	font-size: 25px;
	font-family: "微软雅黑";
	text-align: center;
	margin: 0px
}

#registered .con {
	width: 293px;
	height: 300px;
	margin: 2px auto;
}

#registered .con p {
	color: #666;
	font-size: 20px;
	font-family: "微软雅黑";
	height: 40px;
	line-height: 40px
}

#registered .con p input {
	height: 35px;
	width: 300px
}

#registered .con p input.but {
	margin: 30px auto;
	color: #fff;
	font-size: 20px;
	font-family: "微软雅黑";
	background: black;
	border: none
}

.layer {
	width: 100%;
	height: 130%;
	background: #000;
	position: absolute;
	top: 0px;
	left: 0px;
	filter: Alpha(opacity = 70);
	-moz-opacity: 0.7;
	opacity: 0.7;
	display: none;
}

#button {
	display: none;
}

#button2 {
	display: none;
}

#button:checked  ~ #login {
	display: block;
}

#button:checked  ~ .layer {
	display: block;
}

#button2:checked  ~ #registered {
	display: block;
}

#button2:checked  ~ .layer {
	display: block;
}

#login .wjmm p {
	font-size: 15px;
	float: right;
}
#kline{
	width: 80%;height: 50%;text-align: center;
margin: 0 auto;position: relative;top: 30%;
}
#hotstock{
	width: 80%;height: 50%;text-align: center;
margin: 0 auto;position: relative;top: 40%;

}
 table,table tr th, table tr td { border:1px solid #0094ff; }
 table {  min-height: 25px; line-height: 25px; text-align: center; border-collapse: collapse; padding:2px;border-collapse: collapse;table-layout:fixed}  

table td {

}
table thead{
height:20%;
}
</style>
<script >

		function init() {
			var name=${uname};
			alert(name);
			if (name!=null) {
				document.getElementById("uname2").innerHTML =${uname};
				document.getElementById("uname").innerHTML = "";
				document.getElementById("regbut").innerHTML = "";
				document.getElementById("exit").innerHTML = "退出登录";
				
			} else {
				document.getElementById("uname2").innerHTML ="";
				document.getElementById("uname").innerHTML = "登陆";
			}
				
		}
		function exit()
		{
			document.getElementById("uname2").innerHTML ="";
			document.getElementById("uname").innerHTML = "登陆";
		}
		</script>
	</head>
	
	<body onload="init()" style="text-align: center;margin: 0 auto;">
		
		<div style="width: 80%;height: 100%;text-align: center;margin: 0 auto;">
			<!-- Unnamed (图片) -->
		<div id="u9">
			<a href="${path}/page/PageCtrl.php?name=${uname}"><img id="u9_img" class="img " src="../images/index/u9.jpg" /></a>
			<!-- Unnamed () -->
		</div>
			<!-- Unnamed (文本框) -->
		<div id="u0" >
			<input id="u0_input" type="text" value="" />
		</div>
		<!-- Unnamed (矩形) -->
		<div id="u1" class="ax_default primary_button">
			<div id="u1_div" class=""><span>搜索</span></div>
		</div>

		<!-- Unnamed (矩形) -->
		<div id="u3" class="ax_default link_button">
			<div id="u3_div" class=""></div>
			<!-- Unnamed () -->
			<script type="text/javascript">
					
					

					function Down(){
						$(document).ready(
											function() {
												$("#ull").css("color", "blue")
														.slideDown(1000).css(
																"position",
																"relative")

								});
					}
					
					function Up(){
						$(document).ready(
											function() {
												$("#ull").css("color", "blue")
														.slideUp(1000).css(
																"position",
																"relative")

								});
					}
				</script>
			<div id="u4" class="text">
			
				<label  for="button"><span id="uname">登陆</span></label> 
				<div  id="uname2" onmouseover="Down()" onclick="Up()"></div>
				
				<ul style=" background-color:white;box-shadow:1px 1px 2px darkgray;
					border-radius:5px; list-style:none;float: left; margin: 0px;padding: 0" hidden="hidden"  id="ull" >
					<a href="${path}/page/InfoPageCtrl.php?name=${uname}"><li>订&#12288;&#12288;单</li></a>
					<a href="${path}/page/SetPageCtrl.php?name=${uname}"><li>设&#12288;&#12288;置</li></a>
					<a href="${path}/page/CollectPageCtrl.php?name=${uname}"><li>收&#12288;&#12288;藏</li></a>
					<a href="${path}/page/DelegetePageCtrl.php?name=${uname}"><li>委&#12288;&#12288;托</li></a>
					<a href="${path}/page/WalletPageCtrl.php?name=${uname}"><li>钱&#12288;&#12288;包</li></a>
				</ul>
				
			</div>
		</div>
		<!-- Unnamed (矩形) -->
		<div id="u5" class="ax_default link_button">
			<div id="u5_div" class=""></div>
			<!-- Unnamed () -->
			<div id="u6" class="text">
				<label id="regbut" for="button2">注册</label>
				<label id="exit" onclick="exit()"></label>
			</div>
		</div>
	
		<div id="kline">
		<img style="width: 100%;height: 100%;" id="u13_img" class="img " src="../images/index/u13.png" />
		</div>
		<div id="hotstock">
			<table  style="width: 100%;height: 100%;position: relative;">
				<thead>
				<tr>
					<th>股票代码</th>
					<th>股票名称</th>
					<th>最新价格</th>
					<th>操作</th>
				</tr>
				</thead>
				<tbody >
					<c:forEach var = "stockbean" begin="0" step="1" items="${list}">
					<tr >
						<td  >
							<a href="javascript:void(0);" onclick="sure(this)">${stockbean.getStockCode()}</a>
						</td>
						<td>
							${stockbean.getStockName()}
						</td>
						<td>
							${stockbean.getStockPrice()}
						</td>
						<td>
							<%-- <a href="addcollection?stockcode="${stockbean.getStocksModel().getStockCode()}>加入自选</a> --%>
							<button value = "${stockbean.getStockCode()}">加入自选</button>
						</td>
					</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
		<script src="assets/javascripts/jquery-3.2.1.js"></script>
	<script type="text/javascript">
		$(function(){
			var $table=$('table');//获取表格对象
			var currentPage=0;//设置当前页默认值为0
			var pageSize=7;//设置每一页要显示的数目
			$table.bind('paging',function(){
				$table.find('tbody tr').hide().slice(currentPage*pageSize,(currentPage+1)*pageSize).show();
				});//先将tbody中所有行隐藏，再通过slice结合当前页数和页面显示的数目展示出数据
			
			var sumRows=$table.find('tbody tr').length;//获取数据总行数
			var sumPages=Math.ceil(sumRows/pageSize);//得到总页数
			
			var $pager=$('<div class="page"></div>');
			for(var pageIndex=0;pageIndex<sumPages;pageIndex++){
				$('<a><span>'+(pageIndex+1)+'</span></a>').bind("click",{"newPage":pageIndex},function(event){
					currentPage=event.data["newPage"];
					$table.trigger("paging");
					//为每一个要显示的页数上添加触发分页函数
				}).appendTo($pager);
				$pager.append(" ");
			}
			$pager.insertAfter($table);
			$table.trigger("paging");
		});
		 
		function sure(obj){
			var stockCode=$(obj).html();  
			location.href="stockpage?stockCode="+stockCode;
		}

			$('button').click(function getVal(){
				var stockCode = $(this).val();
				var data = {
						stockCode : stockCode
				};
				alert(stockCode);
				$.ajax({
					 url:"http://localhost:18080/com.dfrz.stockMarket/AddCollection",  
					 async:true,  
					  cache:false,  
					  type:"get",
					  dataType:'text',
					  data:data,
					complete : function(){
						alert("添加成功");
					}
				});
			});
		
		
	</script>
	
		<!-- Unnamed (矩形) -->
		<div id="u15" class="ax_default box_1">
			<img id="u15_img" class="img " src="../images/index/u15.png" />
			<!-- Unnamed () -->
			<div id="u16" class="text">
				<p>
					<span>股市有风险，投资需谨慎！&nbsp; </span>
				</p>
				<p>
					<span><br></span>
				</p>
				<p>
					<span>投资者依此做出的投资行为风险自担！&nbsp; </span>
				</p>
				<p>
					<span><br></span>
				</p>
				<p>
					<span>© 2017 yw|股市通免责声明 </span>
				</p>
			</div>
		</div>
		<input type="checkbox" name="test" id="button">
	<label for="button"></label>

	<div class="layer"></div>
	<div id="login">
<label for="button" class="close"><img src="../images/timg.png"></label> 
<div style="clear: both"></div>
<h3>登陆</h3>
<div class="con">
<form action="${path}/action/LoginActionCtrl.php" id="acform" method="get">
				<p>账号:
				<p>
					<input id="nametext" type="text" name="name">
				<p>密码:
				<p>
					<input id="pwdtext" type="password" name="pwd">
				<div class="wjmm">
					<a href="www.baidu.com">忘记密码？</a>
				</div>
				<p>
					<input id="butt" type="button" onclick="checkUser()" value="登&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;陆" class="but">
				</p>
			</form>
<script type="text/javascript">
 function checkUser(){
	 var name=document.getElementById("nametext").value;
	 var pwd=document.getElementById("pwdtext").value;
	 var acform=document.getElementById("acform");
	 alert(name);
	 if(name=null||name==""){
		 alert("账户名不能为空！");
	 }else if(pwd==null||pwd==""){
		 alert("密码名不能为空！");
	 }
	 else{
		 acform.submit();
	 }
 }
</script>
		</div>
	</div>
 
<input type="checkbox" name="test" id="button2">
<label for="button2"></label>
<div class="layer"></div>

<div id="registered">
<label for="button2" class="close"><img src="../images/timg.png"></label> 
<h3>注册</h3>
<div class="con">
<form id="regform" action="${path}/page/RegisterActionCtrl.php" id="acform" method="get">
<p>用户名:<p>
<input id="regname" type="number" name="regname">
<p>手机号:<p>
<input type="text" name="iphone">
<p>验证码:<p>
<input type="text" name="yanzheng">
<p>密码:<p>
<input id="regpwd" type="password" name="pwd">
<p>确认密码:<p>
<input id="regpwd2" type="password" name="pwd2">
<p><input type="button" onclick="regsub()" value="立即注册" class="but"></p>
</form>
<script type="text/javascript">
function regsub(){
	var regform=document.getElementById("regform")
	var regname=document.getElementById("regname").value
	var regpwd=document.getElementById("regpwd").value
	var regpwd2=document.getElementById("regpwd2").value
	if(regname == null||regname==""){
		alert("用户名不能为空")
		
	}else if(regpwd == null||regpwd=="")
	{
		alert("密码不能为空");
	}else if(regpwd2 == null||regpwd2=="")
	{
		alert("确认密码不能为空");
	}
	else if(regpwd!=regpwd2)
	{
		alert("密码和确认密码不同");
	}else{
		regform.submit();
	}
}
</script>
</div>
	</div>
	</div>
	</body>
</html>
